﻿using System;
using System.Data;
using System.Data.Common;

namespace Vbyte.SharpOrm
{
    /// <summary>
    /// 排序方向
    /// </summary>
    public enum SqlOrderByDirection : byte
    {
        /// <summary>
        /// 顺序
        /// </summary>
        ASC,
        /// <summary>
        /// 倒序
        /// </summary>
        DESC
    }

    /// <summary>
    /// 对SQL数据OrderBy的OO实现
    /// </summary>
    public class SqlOrderBy
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlOrderBy"/> class.
        /// </summary>
        /// <param name="fieldName">排序字段</param>
        /// <param name="direction">排序方向</param>
        public SqlOrderBy(string fieldName, SqlOrderByDirection direction)
        {
            FieldName = fieldName;
            Direction = direction;
        }

        /// <summary>
        /// 排序字段
        /// </summary>
        public string FieldName { get; set; }

        /// <summary>
        /// 排序方向
        /// </summary>
        public SqlOrderByDirection Direction { get; set; }
    }
}